<script setup>
import { useRouter } from 'vue-router'
const router = useRouter();
const login = () => {
  router.push({ name: "login" })
}
const zhu = () => {
  router.push({ name: "zhu" })
}
const xiu = () => {
  router.push({ name: "xiu" })
}
const delet = () => {
  router.push({ name: "delet" })
}
// 多页面跳转，每个页面需配置单独的路由和js文件，还需要配置不同页面的入口，在vite.config.js里，跳转的函数不能放在路由页面里，要放在与页面相对应的vue组件里
//在路由页面也要写一个这样的方法，不然找不到方法无法跳转
const ce = () => {
  window.location.href = "./home.html";

  // console.log(router.getRoutes())
}
</script>

<template>
  <div class="c">
    <span><button @click="login">登录</button></span>
    <span><button @click="zhu">注册</button></span>
    <span><button @click="xiu">修改</button></span>
    <span><button @click="delet">删除</button></span>



  </div>
  <router-view></router-view>
</template>

<style scoped>
.c {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin: 2rem auto;
  max-width: 800px;
}

table {
  border-collapse: separate;
  border-spacing: 0.5rem;
  width: 100%;
}

tr {
  transition: all 0.3s ease;
}

td {
  padding: 0;
  border: none;
}

button {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(0);
}

button:nth-child(1) {
  background: linear-gradient(135deg, #007bff, #0062cc);
  color: white;
}

button:nth-child(2) {
  background: linear-gradient(135deg, #28a745, #218838);
  color: white;
}

button:nth-child(3) {
  background: linear-gradient(135deg, #ffc107, #e0a800);
  color: #212529;
}

button:nth-child(4) {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
}
</style>
